package com.blue.firecat.enums;

/**
 * 描述
 * 时间 2017/6/22 22:19
 * 作者 廖林山
 */
public enum TradeStatusEnum {
    UNKNOWN(0, "未知"),
    REVIEW(1, "正在审核"),
    IS_WORK(2, "正在代练"),
    TO_BE_ACCEPTED(3, "等待验收"),
    TO_BE_SETTLED(4, "等待结算"),
    HAS_BEEN_SETTLED(5, "已经结算"),
    ABNORMAL_ORDERS(6, "订单异常"),
    NOT_PASS(7, "审核失败"),
    CHECK_NOT_PASS(8, "验证失败"),
    APPOINT_BEATER(9, "等待接手");


    private int code;
    private String value;

    TradeStatusEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValueByCode(int code) {
        for (TradeStatusEnum status : TradeStatusEnum.values()) {
            if (code == status.getCode()) {
                return status.getValue();
            }
        }
        return UNKNOWN.value;
    }

    public static int getCodeByValue(String value) {
        for (TradeStatusEnum status : TradeStatusEnum.values()) {
            if (status.getValue().equals(value)) {
                return status.getCode();
            }
        }
        return UNKNOWN.code;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }


}
